package com.saasitems.admin.service;

import com.github.pagehelper.PageHelper;
import com.saasitems.admin.dao.ManagerUserMapper;
import com.saasitems.admin.dao.PartsTypeMapper;
import com.saasitems.admin.model.ManagerUser;
import com.saasitems.admin.model.ManagerUserExample;
import com.saasitems.admin.model.PartsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2016/12/16.
 */
@Service
public class ManagerUserService {

    @Autowired
    private ManagerUserMapper managerUserMapper;

    @Autowired
    private PartsTypeMapper partsTypeMapper;

    public void selectAll() {
//        ManagerUser u = managerUserMapper.selectByPrimaryKey(7);
        ManagerUserExample ep = new ManagerUserExample();
//        ep.setOrderByClause("ID");
//
        PageHelper.startPage(1, 1);
        List<ManagerUser> ms = managerUserMapper.selectByExample(ep);
        for (ManagerUser mu : ms) {
            System.out.println(mu.getName());
        }
    }

    public void insert() {
        PartsType pt = new PartsType();
        pt.setTypeCode("00001");
        pt.setTypeName("测试");
        pt.setTypeNameEn("ceshi");
        pt.setfId((long) 0);
        pt.setEpId((long) 0);
        pt.setDepartmentId((long) 0);
        pt.setCreatetime(new Date());
        pt.setFlag(0);
        partsTypeMapper.insert(pt);
        System.out.println("selectAll=========>" + pt.getId());
    }
}
